
<template>
    <div>
      <el-transfer
      filterable
      :data="userList"
      :props="prop"
      :titles="titles"
      v-model="values"></el-transfer>
      <el-button plain type="primary" style="margin-top: 10px; margin-left: 88%;" @click="save">绑定</el-button>
    </div>
    
</template>

<script setup>
import { ref,reactive } from 'vue'
import { get,post } from '@/plugins/axios';
const userList = ref([])
const emits = defineEmits(['updata:show'])
const props = defineProps(['roleId'])
const prop = reactive({
  label: 'name',
  key:'id'
})
const titles = reactive(['未选用户', '已选用户'])
const values = ref([])
getuserList()
function getuserList(){
  get("/roleUser/getData",{roleId: props.roleId},content => {
    userList.value = content.userList
    for(const i in content.roleuserList){
      values.value.push(content.roleuserList[i].id)
    }
    console.dir(values.value)
  })
}
function save(){
  console.dir(props.roleId)
  post("/roleUser/save",{ roleId: props.roleId,userIds: values.value},content => {
    emits('update:show', false)
  })
}

</script>

<style scoped lang='scss'>

</style>

